{% extends 'base.html' %}

{% block main_body %}
    <div style="min-height: 458px;">
        <section class="content-header">
          <h1>
            数据包上传
          </h1>
        </section>

        <section class="content container-fluid">
          <div class="row">
            <div class="col-xs-12">

              <div class="box">
                <div class="box-header">
                    <h2 class="box-title">上传数据包文件</h2>
                </div>
                <form class="form-horizontal" action="", method="post", enctype="multipart/form-data">
                {% csrf_token %}
                  <div class="box-body">
                    <div class="form-group">
                      <label class="col-sm-2">选择：</label>
                      <div class="col-sm-4">
                        <input type="file" name="file">
                      </div>
                      <br/>
                      <br/>
                      <div class="col-sm-10">
                          <button type="submit" name="upload" class="btn btn-primary">提交</button> &nbsp;
                          <button type="reset" class="btn btn-default">重置</button>
                          <div class="col-sm-offset-2 col-sm-10"></div>
                      </div>
                    </div>
                  </div>
                  {% if error_message %} <p><strong>{{ error_message }}</strong></p> {% endif %}
                  {% if success_message %} <p><strong>{{ success_message }}</strong></p> {% endif %}
                </form>

                <!-- 删除数据包文件可能要开放后台存储权限，后期可以考虑不删除，把维护文件的功能交给站长 -->
                <div class="box-header">
                    <h2 class="box-title">删除数据包文件</h2>
                </div>
                <form class="form-horizontal" action="" method="post">
                {% csrf_token %}
                  <div class="box-body">
                    <div class="form-group">
                      <label class="col-sm-2">输入文件名：</label>
                      <div class="col-sm-4">
                        <input type="text" name="file_name">
                      </div>
                      <br/>
                      <br/>
                      <div class="col-sm-10">
                          <button type="submit" name="delete" class="btn btn-primary">提交</button> &nbsp;
                          <button type="reset" class="btn btn-default">重置</button>
                          <div class="col-sm-offset-2 col-sm-10"></div>
                      </div>
                    </div>
                  </div>
                  {% if delete_error_message %} <p><strong>{{ delete_error_message }}</strong></p> {% endif %}
                  {% if delete_success_message %} <p><strong>{{ delete_success_message }}</strong></p> {% endif %}
                </form>

              </div>
            </div>
          </div>
        </section>
    </div>
{% endblock %}